package com.chenfan.process.entity.vo;

import com.chenfan.ccp.plug.mybatis.annotation.Column;
import com.chenfan.ccp.plug.mybatis.annotation.Id;
import com.chenfan.ccp.plug.mybatis.handler.DbHandler;
import com.chenfan.process.entity.po.ApprovalTemplatePo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author K
 * @date 2021/3/17
 */
@Data
@NoArgsConstructor
public class ApprovalTemplateVo {

    @Id
    @JsonSerialize(using = ToStringSerializer.class)
    protected Long id;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    protected Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(dateGeneStrategy = DbHandler.DateGeneStrategy.UPDATE)
    protected Date updateTime;

    /**
     * 是否删除
     */
    protected Boolean deletedFlag;
    /**
     * 模板编码
     */
    private String code;

    /**
     * 审批模板标题
     */
    private String title;

    /**
     * 所在分组
     */
    private String templateGroup;

    /**
     * 表单说明
     */
    private String description;

    /**
     * 状态 0-正常 1-停用
     */
    private Integer status;

    /**
     * 创建人
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createBy;

    /**
     * 创建人名称
     */
    private String createName;

    /**
     * 更新人
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long updateBy;

    /**
     * 更新人名称
     */
    private String updateName;

    /**
     * 审批模板当前版本
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long version;

    /**
     * 关联表单名称
     */
    private String formName;

    /**
     * 审批快照id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long approvalSnapshotId;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long belongId;

    /**
     * 所属系统名称
     */
    private String belongSystemName;

    public ApprovalTemplatePo copyApprovalTemplatePo() {
        ApprovalTemplatePo po = new ApprovalTemplatePo();
        org.springframework.beans.BeanUtils.copyProperties(this, po);
        return po;
    }
}
